#pragma comment(linker, "/STACK:10000000")
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <cstdio>
#include <cassert>
#include <string>
#include <cstring>
#define ldb long double
#define LL int
#define fi first
#define se second
#define fill(a, c) memset(a, c, sizeof(a))
#define sqr(a) ((a) * (a))
#define nextLine() {int c = 0; while((c = getchar()) != 10 && c != EOF);}
#define getBit(mask, k) (((mask) / pw[k]) % pw[1])
#define setBit(mask, k, l) (((mask) / pw[k + 1] * pw[1] + (l)) * pw[k] + ((mask) % pw[k]))
#define debug(a) cerr << #a << " = " << a << " ";
#define debugl(a) cerr << #a << " = " << a << "\n";
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define ff first
#define ss second 
const ldb LDINF = 9128739847123.00;
const ldb eps = 1e-9;
const int inf = 1 << 28;
const ldb pi = fabsl(atan2l(0.0, -1.0));
using namespace std;

const LL X = 239017;
set <LL> was[2010];
int z[2010];
int p[2010];
string s1, t, s2;


void load()
{
	cin >> t >> s1 >> s2;
}

void solve()
{
	for (int i = 0; i + (int)s1.size() - 1 < t.size(); i++)
	{
		z[i] = 0;
		for (int j = 0; j < s1.size(); j++)
		{
			if (s1[j] != t[i + j]) break;
			z[i]++;
		}
	}
	for (int i = s2.size() - 1; i < t.size(); i++)
	{
		p[i] = 0;
		for (int j = 0; j < s2.size(); j++)
		{
			if (t[i - j] != s2[(int)s2.size() - j - 1]) break;
			p[i]++;
		}
	}
	int m = max(s1.size(), s2.size());
	LL hash;
	for (int i = 0; i < t.size(); i++)
	{
		hash = 0;
		for (int j = i; j < t.size(); j++)
		{
			hash = hash * X + t[j] - '0' + 1;
			if (j - i + 1 >= m && z[i] == s1.size() && p[j] == s2.size() && was[j - i].find(hash) == was[j - i].end())
				was[j - i].insert(hash);
		}
	}
	int res = 0;
	for (int i = 0; i < t.size(); i++)
		res += was[i].size();
	cout << res;
}

#define file "b"
int main()
{
	#ifndef ONLINE_JUDGE
		freopen(file".in", "rt", stdin);
		freopen(file".out", "wt", stdout);
	#endif
	load();
	solve();
	return 0;
}
